﻿using System;
using XchangeStreamer.Server.Core;
using System.Diagnostics;

namespace XchangeStreamer.Server
{
    class Program
    {
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            int totalSentMessages = 0;

            using (Server.Core.Server server = Server.Core.Server.Instance)
            {
                Console.WriteLine("The market data feed service is available.");
                Console.ReadKey(true);
                totalSentMessages = server.TotalSentMesaages;
            }
            Console.WriteLine("The market data feed service is not available.");
            Console.WriteLine("Total Sent Messages: {0}", totalSentMessages);
        }

        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Console.WriteLine("Exception Message: {0}", e.ExceptionObject.ToString());
        }

    }
}
